using System;
using System.Collections.Generic;
using System.Text;
using LibrErian.Common;
using LibrErian.Model;
using System.Windows.Forms;
using Microsoft.Practices.CompositeUI.SmartParts;
using LibrErian.Common.Constants;
using Microsoft.Practices.CompositeUI.WinForms;

namespace LibrErian.Modules.BasicBook
{
    public class NewAuthorController : WorkItemController
    {
        public Author Run(bool showDialog)
        {
            WorkItem.State["Author"] = new Author();

            WindowSmartPartInfo info = new WindowSmartPartInfo();
            info.Title = "New Author";
            info.Modal = showDialog;

            AuthorView view = WorkItem.SmartParts.AddNew<AuthorView>();
                        
            WorkItem.Workspaces[WorkspaceNames.WindowWorkspace].Show(view, info);

            return WorkItem.State["Author"] as Author;
        }
    }
}
